<?php

function checkPassword($password)
{

    $bool = true;

    if (strlen($password) < 8)
    {
        echo "Password must be at least 8 characters in length.<br>";
        $bool = false;
    }

    if (!preg_match("#[0-9]+#", $password))
    {
        echo "Password must include at least one number.<br>";
        $bool = false;
    }

    if (!preg_match("#[a-zA-Z]+#", $password))
    {
        echo "Password must include at least one letter.<br>";
        $bool = false;
    }

    return $bool;
}

function checkEmail($email)
{
    return filter_var($email, FILTER_VALIDATE_EMAIL);
}

function checkPhoto()
{
    $allowed = array(
        'gif',
        'png',
        'jpg');
    $filename = $_FILES['photo']['name'];
    $ext = pathinfo($filename, PATHINFO_EXTENSION);
    if (!in_array($ext, $allowed))
    {
        return false;
    }
    return true;
}

?>